//-----------------------------------------------------------------------
// <copyright file="MemoryModuleUnitTest.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics
{
    using System;
    using System.Reflection;

    using System.Collections;
    using System.Collections.Generic;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>
    /// Provides unit testing for the <see cref="T:CodePlex.Diagnostics.MemoryModule"/> class.
    /// </summary>
    [TestClass]
    public sealed class MemoryModuleUnitTest
    {
        #region public MemoryModuleUnitTest()

        /// <summary>
        /// Initializes a new instance of the <see cref="T:MemoryModuleUnitTest"/> class.
        /// </summary>
        public MemoryModuleUnitTest()
        {
        }

        #endregion

        #region public void GetMemoryModulesTest()

        /// <summary>
        /// Unit test to exercise the <see cref="M:CodePlex.Diagnostics.Processor.GetProcessors"/> static method.
        /// </summary>
        [TestMethod]
        public void GetMemoryModulesTest()
        {
            IList<MemoryModule> modules = MemoryModule.GetMemoryModules();

            Assert.IsNotNull(modules, "MemoryModule.GetMemoryModules() returned null.");

            Assert.IsTrue(modules.Count > 0, "MemoryModule.GetMemoryModules() returned an IList with a Count of zero.");

            foreach (MemoryModule module in modules)
            {
                Assert.IsNotNull(module, "MemoryModule.GetMemoryModules() returned an IList containing a null MemoryModule instance.");

                Assert.IsFalse(
                    string.IsNullOrEmpty(module.Name),
                    "MemoryModule.GetMemoryModules() returned an IList containing a MemoryModule instance with either a null or empty Name property.");

                Assert.IsFalse(
                    string.IsNullOrEmpty(module.Description),
                    "MemoryModule.GetMemoryModules() returned an IList containing a MemoryModule instance with either a null or empty Description property.");

                Assert.IsFalse(
                    string.IsNullOrEmpty(module.Id),
                    "MemoryModule.GetMemoryModules() returned an IList containing a MemoryModule instance with either a null or empty DeviceId property.");

                Assert.IsTrue(
                    module.Capacity > 0,
                    "MemoryModule.GetMemoryModules() returned an IList containing a MemoryModule instance with an invalid value for the Capacity property.");

                Assert.IsTrue(
                    module.Speed > 0,
                    "MemoryModule.GetMemoryModules() returned an IList containing a MemoryModule instance with an invalid value for the Speed property.");
            }
        }

        #endregion
    }
}

